<style type="text/css">
	div.welcome{
		margin:1rem auto 0rem;
		text-align:center;
	}
	i.router{
		display:inline-block;
		background:url(/luci-static/images/phiwifi.png?_=20170809165512) no-repeat;
		background-size:contain;
		width:5rem;
		height:5rem;
		margin-left:1.2rem;
	}
	div.btn-con-2{
		margin:0.5rem auto 0.35rem;
	}
	div.entry-links{
		font-size:0;
		margin:0.5rem auto 0.25rem;
		text-align:center;
	}
	div.entry-links a{
		font-size:0.4rem;
		color:#FF9919;
		text-decoration:underline;
	}
	p.company{
		margin-bottom:0.25rem;
		text-align:center;
		font-size:0.4rem;
		color:#575757;
	}
	div.pwd-con{
		font-size:0;
		border-bottom:1px solid #E9E9E9;
		width:75%;
		margin:0 auto 0.25rem;
	}
	li.text-con input.text{
		width:4.5rem;
		border-width:0;
		vertical-align:middle;
	}
	li.text-con input.text{
		padding-right:1rem;
	}
	i.err-icon{
		margin-left:1.6rem !important;
	}
	p.note-str{
		width:65% !important;
	}
	#Save{
		width:75%;
	}
	div.remember-con{
		font-size:0;
		text-align:center;
	}
	div.remember-con span{
		color:#4F5356;
		font-size:0.417rem;
		line-height:0.8rem;
		vertical-align:bottom;
	}
	i.icon_lock{
		font-size:0.8rem;
		color:#B2B2B2;
		border-right:1px solid #FE8F19;
		padding:0 0.25rem;
		vertical-align:middle;
	}
	i.check-icon{
		color:#B2B2B2;
		margin-left:0;
		vertical-align:middle;
	}
	i.checked{
		color:#0FD245;
	}
</style>
<script type="text/javascript">
(function(){
	var checked = "checked";
	var PWD_KEY = "loginPwd";

	(function(){	// 尝试从本地读取密码
		var pwd = null;
		var check = $("#Check");

		try{
			pwd = localStorage.getItem(PWD_KEY);
		}catch(e){};

		if (pwd != null && pwd.length > 0){
			check.addClass(checked);
			$("#Pwd").val(pwd);
		}else{
			check.removeClass(checked);
		}

		check.click(function(){
			if ($(this).hasClass(checked)){
				$(this).removeClass(checked);
			}else{
				$(this).addClass(checked);
			}
		});
	})();

	if (OS.app){
		$(".entry-links").addClass("invisible");
	}

	$("#WebPage").click(function(){
		setPageStyle("pc");
		window.location.reload();
	});

	$("#Save").click(function(){
		if (false == $("#Check").hasClass(checked)){
			try{
				localStorage.removeItem(PWD_KEY);
			}catch(e){};
		}

		var pwd = $("#Pwd").val()
		if("" == pwd){
			showNote(errStr.pwdBlank);
			return;
		}

		if (pwd.length < 5){
			showNote(errStr.pwdTooShort);
			return;
		}

		var pwdEncoded = new Base64().base64encode(pwd);
		var data = {};

		data.username = "admin";
		data.password = pwdEncoded;

		apiLogin(data, function(result){
			var code = result[ERR_CODE];
			switch(code){
			case E_NONE:
				if ($("#Check").hasClass(checked)){
					try{
						localStorage.setItem(PWD_KEY, pwd);
					}catch(e){};
				}

				var goGuide = result[K_MODULE].security.login.guide;
				if (1 == goGuide){
					stateman.go("guideNetworkSet", {replace : true});
				}else{
					if ("" == stateman.previous.name || stateman.current.name == stateman.previous.name || "login" == stateman.previous.name){
						stateman.go("phone.netState", {replace : true});
					}else{
						stateman.go(stateman.previous.name, {replace : true});
					}
				}
				break;
			case E_PWDOVTIME:
				showNote(errStr.otherLogin);
				break;
			case E_UNAUTH:
			default:
				showNote(errStr.pwdError);
				break;
			}
		});
	});
})();
</script>
<div class="set-con">
	<div class="welcome">
		<i class="router"></i>
	</div>
	<div class="pwd-con">
		<i class="icon_lock"></i>
		<li class="text-con">
			<input class="text" maxLength="63" id="Pwd" placeholder="{%label.inputPwd%}" /><i class="tip icon-eye" data-value="0"></i>
		</li>
	</div>
	<div class="err-note hidden">
		<i class="err-icon icon_remind_line"></i>
		<p class="note-str"></p>
	</div>
	<div class="btn-con btn-con-2">
		<input id="Save" class="btn" type="button" value="{%btn.login%}" />
	</div>
	<div class="remember-con">
		<i id="Check" class="tip-l check-icon icon_select_on"></i><span>{%label.rememberPwd%}</span>
	</div>
	<div class="entry-links"><a href="javascript:void(0);" id="WebPage">{%label.goWebPage%}</a></div>
	<div class="entry-links"><a href="http://app.phiwifi.phicomm.com/Service/App/downloadpage/chanel/1H5W" target="_blank">{%label.downloadApp%}</a></div>
	<p class="company">{%label.phicommTechnologyCoLtd%}</p>
</div>